<?php


/**
 * @author Kevin
 * @version 1.0
 * @created 12-d�c.-2011 19:51:41
 */
class PublicationFactory
{

	var $type = null;
	var $concretid = null;
	
	function PublicationFactory($id){
		global $wpdb;
		
		// recuperation du type et concretid
		$_row =
		$wpdb->get_row(
			$wpdb->prepare(
				// request
				"SELECT type, fk_concretid FROM publications WHERE id = %d",
				// params
				$id
			)
		);
		
		$this->type = $_row->type;
		$this->concretid = $_row->fk_concretid;
	}
	
	function create(){
		switch ($this->type){
			case "EVENT" :
				return new Event($this->concretid);
				break;
		}
	}

}
?>